# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName:   selenium_self
# FileName:      read_json.py
# Author:       test_liu
# Datetime:     2024/10/14 下午8:21
# Description: 读取测试者的json文件
# ---------------------------------------------------------------------------
import json

from WebTest3.WebTest import log
from WebTest3.WebTest.common.read_user_ini import ReadUserIni


def read_json(file_name, user_dir):
    read_user_ini = ReadUserIni(user_dir)
    file_path = read_user_ini.get_file_path(file_name)
    try:
        with open(file_path, mode="r", encoding="utf-8") as f:
            return json.load(f)
    except Exception as e:
        log.error(f'读取json文件失败，请检查json文件，文件路径为：{file_path}，错误信息为：{e}')
        raise e


if __name__ == '__main__':
    print(read_json("case", "test_liu"))
